<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@ include file="/taglibs.jsp"%>
<c-rt:set var="tp" value="${pu:pageableTag('tpp', 10, 10)}"/>
${pu:reqSet('hql0', 'from KeywordDefault') }

<c-rt:if test="${!empty param.paramId}">
${pu:reqSet('hql1', ' where categoryId=?') }
${pu:listAdd('hqlParam', pu:toLong(param.paramId)) }
</c-rt:if>
<c-rt:if test="${!empty param.keywordStr}">
	<c-rt:if test="${!empty param.paramId}">
	${pu:reqSet('hql2', ' and keyword like ?') }
	</c-rt:if>
	<c-rt:if test="${empty param.paramId}">
	${pu:reqSet('hql2', ' where keyword like ?') }
	</c-rt:if>
	<c-rt:set var="kws">
	%${param.keywordStr }%
	</c-rt:set>
	${pu:listAdd('hqlParam', kws) }
</c-rt:if>
<c-rt:set var="hql" scope="request">
${hql0 }${hql1 }${hql2 }
</c-rt:set>
<c-rt:if test="${!empty hqlParam}">
${pu:reqSet('kds', pu:queryByHql(hql, pu:arrayGet('hqlParam'), tp)) }
</c-rt:if>
<c-rt:if test="${empty hqlParam}">
${pu:reqSet('kds', pu:queryByHql(hql, null, tp)) }
</c-rt:if>

<s:actionerror />
<s:actionmessage />
<s:fielderror />
<br />
<h1>预设关键字管理
<div class="f-link">
<a href="toUpdateDefaultKeyword.do">新增</a>
<a href="#" onclick="document.formObj.submit();">搜寻</a>
</div>
</h1>
<div class="data-form">
<s:form action="listDefaultKeyword.do" method="post" name="formObj">
<table width="700">
<tr>
	<td width="15%">目錄ID：</td>
	<td width="35%"><s:textfield name="paramId"/></td>
	<td width="15%">关键字：</td>
	<td width="35%"><input type="text" name="keywordStr" value="${param.keywordStr }"/></td>
</tr>
</table>
</s:form>
</div>
<p>&nbsp;</p><p>&nbsp;</p>
	<table class="tb-1" width="700">
		<thead>
			<tr>
				<th>目錄ID</th>
				<th>Keyword</th>
				<th>操作</th>
			</tr>
		</thead>
		<c-rt:if test="${!empty kds}">
		<tbody>
			<c:forEach items="${kds}" var="keyword" varStatus="rows_index">
				<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
					<td><a href="toUpdateDefaultKeyword.do?paramId=${keyword.id}" />${keyword.categoryId}</a></td>
					<td><c:out value="${keyword.keyword}"/></td>
					<td>
					<input type="button" value="删除" onclick="if(confirm('确认删除？')){location.href='deleteDefaultKeyword.do?defId=${keyword.id}';}"></input>
					<input type="button" value="编辑" onclick="location.href='toUpdateDefaultKeyword.do?paramId=${keyword.id}'"></input>
					
					</td>
				</tr>
			</c:forEach>
		</tbody>
		</c-rt:if>
		<s:else>
			<tbody>
				<tr class="bg-yl"><td colspan="6">查无资料!!</td></tr>
			</tbody>
		</s:else>
	</table>	
	<c-rt:set var="url">
<%=application.getContextPath() %>/keyword/listDefaultKeyword.do
</c-rt:set>
<pageable:Pageable url="${url}" escapeparams="iamlazy,AJAX,refreshZone" formname="kdForm" key="tpp"></pageable:Pageable>

